' P r o g r a m m a   p e r   c o n t r o l l a r e   u n a   s c h e d a   Z X Y 6 0 0 5 s   o p p u r e   Z X Y 6 0 2 0 s 
 
 ' U N I L A B S   E X P E R I M E N T S   2 0 2 0 
 
 ' E m a n u e l e   F .   M a r a n o 
 
 ' V e r s i o n   2 . 0 5 
 
 ' 2 6 / 0 8 / 2 0 2 0 
 
 ' S e t   S p e e d   t o   7   o r   h i g h e r 
 
 
 
 ' D i c h i a r a z i o n e   v a r i a b i l i   g l o b a l i 
 
 V a r i a b l e   N u m e r i c   T e m p o _ A t t e s a 
 
 V a r i a b l e   N u m e r i c   V o l t 
 
 V a r i a b l e   N u m e r i c   A m p e r e 
 
 V a r i a b l e   N u m e r i c   T e m p e r a t u r a 
 
 V a r i a b l e   N u m e r i c   p o r t a _ s e r i a l e 
 
 V a r i a b l e   S t r i n g   A d d r e s s 
 
 V a r i a b l e   S t r i n g   S t a t o _ s e r i a l e 
 
 V a r i a b l e   N u m e r i c   B u t t o n _ V S E T 
 
 V a r i a b l e   N u m e r i c   B u t t o n _ I S E T 
 
 V a r i a b l e   N u m e r i c   B u t t o n _ V O U T 
 
 V a r i a b l e   N u m e r i c   B u t t o n _ I O U T 
 
 V a r i a b l e   N u m e r i c   B u t t o n _ T e m p e r a t u r e 
 
 V a r i a b l e   N u m e r i c   B u t t o n _ C C C V 
 
 V a r i a b l e   N u m e r i c   B u t t o n _ S t a t u s 
 
 V a r i a b l e   N u m e r i c   B u t t o n _ P o w e r 
 
 V a r i a b l e   N u m e r i c   B u t t o n _ R e s i s t a n c e 
 
 
 
 ' A s s e g n a z i o n e   v a r i a b i l i   g l o b a l i 
 
 T e m p o _ A t t e s a   =   0 . 1 0 
 
 p o r t a _ s e r i a l e   =   - 1 
 
 A d d r e s s   =   " A B C " 
 
 S t a t o _ s e r i a l e   =   " N U L L " 
 
 B u t t o n _ V S E T   =   6 
 
 B u t t o n _ I S E T   =   7 
 
 B u t t o n _ S t a t u s   =   5 
 
 B u t t o n _ V O U T   =   8 
 
 B u t t o n _ I O U T   =   9 
 
 B u t t o n _ C C C V   =   1 2 
 
 B u t t o n _ T e m p e r a t u r e   =   1 3 
 
 B u t t o n _ P o w e r   =   1 0 
 
 B u t t o n _ R e s i s t a n c e   =   1 1 
 
 
 
 ' D i c h i a r a z i o n e   b o t t o n i 
 
 B u t t o n   1   T e x t   I n i z i a l i z z a   s e r i a l e 
 
 B u t t o n   1   C o l o r   D a r k O r a n g e 
 
 B u t t o n   2   T e x t   A v v i a   A p p l i c a z i o n i 
 
 B u t t o n   2   C o l o r   L i g h t B l u e 
 
 B u t t o n   3   T e x t   S e t 0   ' S p e g n e   l ' o u t p u t   e   i m p o s t a   c o r r e n t e   e   t e n s i o n e   a   0 V 
 
 B u t t o n   3   C o l o r   Y e l l o w 
 
 B u t t o n   4   T e x t   S t a r t   V R a m p 
 
 B u t t o n   4   C o l o r   Y e l l o w 
 
 B u t t o n   B u t t o n _ V S E T   T e x t   V S E T : 
 
 B u t t o n   B u t t o n _ V S E T   C o l o r   S a l m o n 
 
 B u t t o n   B u t t o n _ I S E T   T e x t   I S E T : 
 
 B u t t o n   B u t t o n _ I S E T   C o l o r   S a l m o n 
 
 B u t t o n   B u t t o n _ T e m p e r a t u r e   T e x t   " T e m p e r a t u r e " 
 
 B u t t o n   B u t t o n _ T e m p e r a t u r e   C o l o r   A q u a m a r i n e 
 
 B u t t o n   B u t t o n _ S t a t u s   T e x t   O U T 
 
 B u t t o n   B u t t o n _ S t a t u s   C o l o r   R e d 
 
 B u t t o n   B u t t o n _ V O U T   T e x t   " V O U T " 
 
 B u t t o n   B u t t o n _ V O U T   C o l o r   R e d 
 
 B u t t o n   B u t t o n _ I O U T   T e x t   I O U T 
 
 B u t t o n   B u t t o n _ I O U T   C o l o r   R e d 
 
 B u t t o n   B u t t o n _ C C C V   T e x t   C C - C V 
 
 B u t t o n   B u t t o n _ C C C V   C o l o r   L i g h t B l u e 
 
 B u t t o n   B u t t o n _ P o w e r   T e x t   P o w e r 
 
 B u t t o n   B u t t o n _ P o w e r   C o l o r   R e d 
 
 B u t t o n   B u t t o n _ R e s i s t a n c e   T e x t   R e s i s t a n c e 
 
 B u t t o n   B u t t o n _ R e s i s t a n c e   C o l o r   R e d 
 
 
 
 C o n t r o l s   O p e n T e x t B o x 
 
 P r i n t   " A v a i l a b l e   s e r i a l   p o r t s : "   +   C R L F 
 
 P r i n t   C O M _ P o r t N a m e s   +   C R L F 
 
 ' I n i z i o   C i c l o   F O R   d i   l e t t u r a   p r i n c i p a l e 
 
 L a b e l   C i c l o _ p r i n c i p a l e 
 
 	 S e l e c t   S t a t o _ s e r i a l e 
 
 	 	 C a s e   " N U L L " 
 
 	 	 	 P r i n t   " P l e a s e   o p e n   C O M   p o r t   f i r s t "   +   C R L F 
 
 	 	 	 P r i n t   " P r e s s   I n i z i a l i z z a   s e r i a l e "   +   C R L F 
 
 	 	 	 W a i t   S e c o n d s   0 . 2 
 
 	 	 	 G o t o   S t o p p e d 
 
 	 	 C a s e   " C L O S E D " 
 
 	 	 	 P r i n t   " C O M   P o r t   C l o s e d "   +   C R L F 
 
 	 	 	 P r i n t   " P l e a s e   o p e n   C O M   p o r t   f i r s t "   +   C R L F 
 
 	 	 	 P r i n t   " P r e s s   I n i z i a l i z z a   s e r i a l e "   +   C R L F 
 
 	 	 	 W a i t   S e c o n d s   0 . 2 
 
 	 	 	 G o t o   S t o p p e d 
 
 	 	 C a s e   " O P E N E D " 
 
 	 	 	 P r i n t   " P o r t a   s e r i a l e   "   +   p o r t a _ s e r i a l e   +   "   a p e r t a "   +   C R L F 
 
 	 	 	 F o r   v 9   =   1   T o   9 e 9 9 
 
 	 	 	 	 C O M   W r i t e S t r i n g   A d d r e s s   +   " r u "   +   L F 	 ' L e t t u r a   t e n s i o n e   O U T 
 
 	 	 	 	 W a i t   S e c o n d s   T e m p o _ A t t e s a 
 
 	 	 	 	 v 3   =   R i g h t ( C O M _ R e c e i v e d , 4 ) 
 
 	 	 	 	 S l o t ( 1 0 2 )   =   v 3 / 1 0 0 
 
 	 	 	 	 B u t t o n   B u t t o n _ V O U T   T e x t   " V O U T :   "   +   v 3 / 1 0 0   +   " V " 
 
 	 	 	 	 B u t t o n   B u t t o n _ V O U T   C o l o r   L i m e 
 
 	 	 	 	 C O M   W r i t e S t r i n g   A d d r e s s   +   " r i "   +   L F 	 ' L e t t u r a   c o r r e n t e   O U T 
 
 	 	 	 	 W a i t   S e c o n d s   T e m p o _ A t t e s a 
 
 	 	 	 	 v 3   =   R i g h t ( C O M _ R e c e i v e d , 4 ) 
 
 	 	 	 	 S l o t ( 1 0 3 )   =   v 3 / 1 0 0 0 
 
 	 	 	 	 B u t t o n   B u t t o n _ I O U T   T e x t   " I O U T :   "   +   v 3 / 1 0 0 0   +   " A " 
 
 	 	 	 	 B u t t o n   B u t t o n _ I O U T   C o l o r   L i m e 
 
 	 	 	 	 C O M   W r i t e S t r i n g   A d d r e s s   +   " r c "   +   L F 	 ' L e t t u r a   C o n t r o l   S t a t e 
 
 	 	 	 	 W a i t   S e c o n d s   T e m p o _ A t t e s a 
 
 	 	 	 	 B u t t o n   B u t t o n _ P o w e r   T e x t   " P o w e r :   "   +   F o r m a t ( S l o t ( 1 0 2 ) * S l o t ( 1 0 3 ) , " 0 . 0 0 0 " )   +   " W " 
 
 	 	 	 	 B u t t o n   B u t t o n _ R e s i s t a n c e   T e x t   " R :   "   +   F o r m a t ( S l o t ( 1 0 2 ) / S l o t ( 1 0 3 ) , " 0 . 0 0 0 " )   +   " O h m " 
 
 	 	 	 	 v 3   =   R i g h t ( C O M _ R e c e i v e d , 1 ) 
 
 	 	 	 	 S l o t ( 1 0 4 )   =   v 3 
 
 	 	 	 	 I f   v 3   =   1 
 
 	 	 	 	 	 B u t t o n   B u t t o n _ C C C V   T e x t   C C 
 
 	 	 	 	 E l s e 
 
 	 	 	 	 	 B u t t o n   B u t t o n _ C C C V   T e x t   C V 
 
 	 	 	 	 E n d I f 
 
 	 	 	 	 C O M   W r i t e S t r i n g   A d d r e s s   +   " r t "   +   L F 	 ' L e t t u r a   t e m p e r a t u r a 
 
 	 	 	 	 W a i t   S e c o n d s   T e m p o _ A t t e s a 
 
 	 	 	 	 S l o t ( 1 0 5 )   =   R i g h t ( C O M _ R e c e i v e d , 3 ) 
 
 	 	 	 	 B u t t o n   B u t t o n _ T e m p e r a t u r e   T e x t   " T e m p e r a t u r e "   +   C R L F   +   S l o t ( 1 0 5 )   +   " C " 
 
 	 	 	 	 C O M   W r i t e S t r i n g   A d d r e s s   +   " r o "   +   L F 	 ' L e t t u r a   S t a t o   o u t p u t 
 
 	 	 	 	 W a i t   S e c o n d s   T e m p o _ A t t e s a 
 
 	 	 	 	 v 3   =   R i g h t ( C O M _ R e c e i v e d , 1 ) 
 
 	 	 	 	 S l o t ( 1 0 6 )   =   v 3 
 
 	 	 	 	 I f   v 3   =   1 
 
 	 	 	 	 	 B u t t o n   B u t t o n _ S t a t u s   T e x t   O U T   O N 
 
 	 	 	 	 	 B u t t o n   B u t t o n _ S t a t u s   C o l o r   G r e e n Y e l l o w 
 
 	 	 	 	 E l s e 
 
 	 	 	 	 	 I f   v 3   =   0 
 
 	 	 	 	 	 	 B u t t o n   B u t t o n _ S t a t u s   T e x t   O U T   O F F 
 
 	 	 	 	 	 	 B u t t o n   B u t t o n _ S t a t u s   C o l o r   R e d 
 
 	 	 	 	 	 E l s e 
 
 	 	 	 	 	 	 P r i n t   " W r o n g   S t a t u s   R e c e i v e d "   +   C R L F 
 
 	 	 	 	 	 E n d I f 
 
 	 	 	 	 E n d I f 
 
 	 	 	 	 W a i t   S e c o n d s   1 
 
 	 	 	 	 S t a t o _ s e r i a l e   =   C O M _ S t a t u s 
 
 	 	 	 N e x t 
 
 	 	 C a s e E l s e 
 
 	 	 	 P r i n t   " E r r o r " 
 
 	 	 	 G o t o   S t o p p e d 
 
 	 E n d S e l e c t 
 
 G o t o   C i c l o _ p r i n c i p a l e 
 
 
 
 L a b e l   S t o p p e d   ' Q U I   I L   P R O G R A M M A   V A   I N   C R A S H 
 
 	 W a i t   S e c o n d s   0 . 2 
 
 S t o p 
 
 
 
 ' I n i z i a l i z z a   l a   p o r t a   s e r i a l e 
 
 L a b e l   I n i z i a l i z z a   s e r i a l e 
 
 	 I f   C O M _ S t a t u s   =   " C L O S E D " 
 
 	 	 I f   p o r t a _ s e r i a l e   =   - 1   O r   A d d r e s s   =   " A B C " 
 
 	 	 	 p o r t a _ s e r i a l e   =   I n p u t   ( " S c r i v i   i l   n u m e r o   d e l l a   p o r t a   s e r i a l e   d a   a p r i r e " ) 
 
 	 	 	 A d d r e s s   =   I n p u t   " I n d i r i z z o   d i s p o s i t i v o   ( A ,   B . . . ) " 
 
 	 	 E n d I f 
 
 	 	 C O M   O p e n   p o r t a _ s e r i a l e   9 6 0 0 
 
 	 	 I f   C O M _ S t a t u s   =   " O P E N E D " 
 
 	 	 	 C o n t r o l s   C l e a r T e x t B o x 
 
 	 	 	 P r i n t   " P o r t a   "   +   p o r t a _ s e r i a l e   +   "   A p e r t a "   +   C R L F 
 
 	 	 	 B u t t o n   1   C o l o r   P a l e G r e e n 
 
 	 	 	 C O M   W r i t e S t r i n g   A d d r e s s   +   " a "   +   L F 
 
 	 	 	 W a i t   S e c o n d s   T e m p o _ A t t e s a 
 
 	 	 	 s 1   =   C O M _ R e c e i v e d 
 
 	 	 	 P r i n t   s 1   +   C R L F 
 
 	 	 	 I f   L e f t ( s 1 , 3 )   =   " Z X Y " 
 
 	 	 	 	 P r i n t   " D i s p o s i t i v o   P o w e r   S u p p l y   Z X Y 6 0 X X s   T r o v a t o ! "   +   C R L F 
 
 	 	 	 	 B u t t o n   1   C o l o r   G r e e n Y e l l o w 
 
 	 	 	 E l s e 
 
 	 	 	 	 P r i n t   " D i s p o s i t i v o   Z X Y 6 0 X X s   n o n   t r o v a t o ! "   +   C R L F 
 
 	 	 	 	 B u t t o n   1   C o l o r   R e d 
 
 	 	 	 	 R e t u r n 
 
 	 	 	 E n d I f 
 
 	 	 	 C O M   W r i t e S t r i n g   A d d r e s s   +   " v "   +   L F 
 
 	 	 	 W a i t   S e c o n d s   T e m p o _ A t t e s a 
 
 	 	 	 P r i n t   C O M _ R e c e i v e d   +   C R L F 
 
 	 	 	 C O M   W r i t e S t r i n g   A d d r e s s   +   " r t "   +   L F 
 
 	 	 	 W a i t   S e c o n d s   T e m p o _ A t t e s a 
 
 	 	 	 s 2   =   C O M _ R e c e i v e d 
 
 	 	 	 B u t t o n   B u t t o n _ T e m p e r a t u r e   T e x t   " T e m p e r a t u r e "   +   C R L F   +   R i g h t ( s 2 , 3 )   +   " C " 
 
 	 	 	 B u t t o n   B u t t o n _ P o w e r   C o l o r   G r e e n 3 
 
 	 	 	 B u t t o n   B u t t o n _ R e s i s t a n c e   C o l o r   G r e e n 3 
 
 	 	 E l s e 
 
 	 	 	 P r i n t   " U n a b l e   t o   o p e n   S p e c i f i e d   C O M   P o r t "   +   C R L F 
 
 	 	 E n d I f 
 
 	 E l s e 
 
 	 	 C O M   C l o s e 
 
 	 	 P r i n t   " P o r t a   "   +   p o r t a _ s e r i a l e   +   "   C h i u s a "   +   C R L F 
 
 	 	 B u t t o n   1   C o l o r   D a r k O r a n g e 
 
 	 E n d I f 
 
 	 S t a t o _ s e r i a l e   =   C O M _ S t a t u s 
 
 R e t u r n 
 
 
 
 ' A v v i a   l e   a l t r e   a p p l i c a z i o n i   p e r   m o n i t o r a r e 
 
 L a b e l   A v v i a   A p p l i c a z i o n i 
 
 	 ' L o a d   T h e r e m i n o _ H A L \ T h e r e m i n o _ H A L . e x e 
 
 	 ' L o a d   T h e r e m i n o _ A r d u H A L \ T h e r e m i n o _ A r d u H A L . e x e 
 
 	 L o a d   T h e r e m i n o _ H A L \ T h e r e m i n o _ S l o t V i e w e r . e x e 
 
 	 ' L o a d   T h e r e m i n o _ B u t t o n s \ T h e r e m i n o _ B u t t o n s . e x e 
 
 	 L o a d   T h e r e m i n o _ S i g n a l S c o p e \ T h e r e m i n o _ S i g n a l S c o p e . e x e 
 
 	 P r i n t   " A p p l i c a z i o n i   a p e r t e "   +   C R L F 
 
 	 B u t t o n   2   C o l o r   D a r k O r a n g e 
 
 R e t u r n 
 
 
 
 ' S p e g n e   l ' u s c i t a   d e l l ' a l i m e n t a t o r e   e   i m p o s t a   a   0   t e n s i o n e   e   c o r r e n t e 
 
 L a b e l   S e t 0 
 
 	 I f   C O M _ S t a t u s   =   " C L O S E D " 
 
 	 	 P r i n t   " L a   p o r t a   C O M     c h i u s a " 
 
 	 	 R e t u r n 
 
 	 E l s e 
 
 	 	 C O M   W r i t e S t r i n g   A d d r e s s   +   " s o 0 "   +   L F 	 ' S p e g n e   l ' o u t p u t 
 
 	 	 W a i t   S e c o n d s   T e m p o _ A t t e s a 
 
 	 	 C O M   W r i t e S t r i n g   A d d r e s s   +   " s u 0 0 0 0 0 "   +   L F 	 ' I m p o s t a   0 V 
 
 	 	 W a i t   S e c o n d s   T e m p o _ A t t e s a 
 
 	 	 C O M   W r i t e S t r i n g   A d d r e s s   +   " s i 0 0 0 0 "   +   L F 	 ' I m p o s t a   0 A 
 
 	 	 B u t t o n   B u t t o n _ V S E T   T e x t   " V S E T :   0 V " 
 
 	 	 B u t t o n   B u t t o n _ I S E T   T e x t   " I S E T :   0 A " 
 
 	 E n d I f 
 
 R e t u r n 
 
 
 
 ' I n i z i a   u n a   r a m p a   d i   t e n s i o n e   e   s a l v a   s u   f i l e   i   d a t i 
 
 L a b e l   S t a r t   V R a m p 
 
 	 I f   C O M _ S t a t u s   =   " C L O S E D " 
 
 	 	 P r i n t   " L a   p o r t a   C O M     c h i u s a "   +   C R L F 
 
 	 	 R e t u r n 
 
 	 E l s e 
 
 	 	 V a r i a b l e   N u m e r i c   V M a x 
 
 	 	 V a r i a b l e   N u m e r i c   V S t e p 
 
 	 	 V a r i a b l e   N u m e r i c   T i m e S t e p 
 
 	 	 V a r i a b l e   N u m e r i c   I M a x 
 
 	 	 V a r i a b l e   N u m e r i c   T i m e 
 
 	 	 V a r i a b l e   N u m e r i c   I n i t i a l _ T i m e 
 
 	 	 V a r i a b l e   N u m e r i c   C C _ S t a t u s 
 
 	 	 V M a x   =   I n p u t   " I n s e r t   V M a x   ( V ) " 
 
 	 	 V S t e p   =   I n p u t   " I n s e r t   V S t e p   ( V ) " 
 
 	 	 T i m e S t e p   =   I n p u t   " I n s e r t   T i m e S t e p   ( s ) " 
 
 	 	 I M a x   =   I n p u t   " I n s e r t   I M a x   ( A ) " 
 
 	 	 T i m e   =   0 
 
 	 	 I n i t i a l _ T i m e   =   0 
 
 	 	 v 2   =   M e s s a g e   " C o n f i r m   s t a r t i n g   V R a m p ? " 	 ' M e s s a g g i o   d i   c o n f e r m a 
 
 	 	 I f   v 2   =   0 
 
 	 	 	 R e t u r n 
 
 	 	 E n d I f 
 
 	 	 	 ' C a n c e l l a z i o n e   v e c c h i   f i l e s   s e   p r e s e n t i 
 
 	 	 P r i n t   " O l d   d a t a   f i l e   w i l l   b e   d e l e t e d "   +   C R L F 
 
 	 	 W a i t   S e c o n d s   1 
 
 	 	 V a r i a b l e   S t r i n g   F i l e _ T i m e 
 
 	 	 V a r i a b l e   S t r i n g   F i l e _ V S E T 
 
 	 	 V a r i a b l e   S t r i n g   F i l e _ I S E T 
 
 	 	 V a r i a b l e   S t r i n g   F i l e _ V O U T 
 
 	 	 V a r i a b l e   S t r i n g   F i l e _ I O U T 
 
 	 	 V a r i a b l e   S t r i n g   F i l e _ T e m p e r a t u r e 
 
 	 	 V a r i a b l e   S t r i n g   F i l e _ C C S T a t u s 
 
 	 	 
 
 	 	 F i l e _ T i m e   =   " Z X Y _ "   +   A d d r e s s   +   " _ T i m e . t x t " 
 
 	 	 F i l e _ V S E T   =   " Z X Y _ "   +   A d d r e s s   +   " _ V S E T . t x t " 
 
 	 	 F i l e _ I S E T   =   " Z X Y _ "   +   A d d r e s s   +   " _ I S E T . t x t " 
 
 	 	 F i l e _ V O U T   =   " Z X Y _ "   +   A d d r e s s   +   " _ V O U T . t x t " 
 
 	 	 F i l e _ I O U T   =   " Z X Y _ "   +   A d d r e s s   +   " _ I O U T . t x t " 
 
 	 	 F i l e _ T e m p e r a t u r e   =   " Z X Y _ D a t a \ Z X Y _ "   +   A d d r e s s   +   " _ T e m p e r a t u r e . t x t " 
 
 	 	 F i l e _ C C S T a t u s   =   " Z X Y _ D a t a \ Z X Y _ "   +   A d d r e s s   +   " _ C C S t a t u s . t x t " 
 
 	 	 
 
 	 	 S a v e   D e l e t e F i l e   F i l e _ T i m e 
 
 	 	 S a v e   D e l e t e F i l e   F i l e _ V S E T 
 
 	 	 S a v e   D e l e t e F i l e   F i l e _ I S E T 
 
 	 	 S a v e   D e l e t e F i l e   F i l e _ V O U T 
 
 	 	 S a v e   D e l e t e F i l e   F i l e _ I O U T 
 
 	 	 S a v e   D e l e t e F i l e   F i l e _ T e m p e r a t u r e 
 
 	 	 S a v e   D e l e t e F i l e   F i l e _ C C S T a t u s 
 
 	 	 P r i n t   " D a t a   F i l e s   d e l e t e d "   +   C R L F 
 
 	 	 
 
 	 	 	 ' S c r i t t u r a   i n t e s t a z i o n e   d e i   f i l e   d i   l o g g i n g 
 
 	 	 S a v e   S t r i n g T o F i l e   " T i m e   ( s ) "   F i l e _ T i m e 
 
 	 	 S a v e   S t r i n g T o F i l e   " V S E T   ( V ) "   F i l e _ V S E T 
 
 	 	 S a v e   S t r i n g T o F i l e   " I S E T   ( V ) "   F i l e _ I S E T 
 
 	 	 S a v e   S t r i n g T o F i l e   " V O U T   ( V ) "   F i l e _ V O U T 
 
 	 	 S a v e   S t r i n g T o F i l e   " I O U T   ( A ) "   F i l e _ I O U T 
 
 	 	 S a v e   S t r i n g T o F i l e   " T e m p e r a t u r e   ( C ) "   F i l e _ T e m p e r a t u r e 
 
 	 	 S a v e   S t r i n g T o F i l e     " C C = 0   C V = 1 "   F i l e _ C C S T a t u s 
 
 	 	 P r i n t   " F i l e s   h e a d i n g s   w r i t t e n "   +   C R L F 
 
 	 	 
 
 	 	 P r i n t   " R a m p i n g . . . "   +   C R L F 
 
 	 	 B u t t o n   4   C o l o r   G r e e n 
 
 	 	 B u t t o n   4   T e x t   " R a m p i n g . . . " 
 
 	 	 
 
 	 	 C O M   W r i t e S t r i n g   A d d r e s s   +   " s u 0 0 0 0 0 "   +   L F 
 
 	 	 W a i t   S e c o n d s   T e m p o _ A t t e s a 
 
 	 	 B u t t o n   B u t t o n _ V S E T   T e x t   " V S E T :   "   +   " 0 . 0 0 V " 
 
 	 	 B u t t o n   B u t t o n _ V S E T   C o l o r   G r e e n Y e l l o w 
 
 	 	 S l o t ( 1 0 0 )   =   0 
 
 	 	 C O M   W r i t e S t r i n g   A d d r e s s   +   " s i "   +   F o r m a t ( I M a x * 1 0 0 , " 0 0 0 0 " )   +   L F 	 ' I m p o s t a   i l   m a s s i m o   v a l o r e   d i   c o r r e n t e   d a   r a g g i u n g e r e 
 
 	 	 W a i t   S e c o n d s   T e m p o _ A t t e s a 
 
 	 	 B u t t o n   B u t t o n _ I S E T   T e x t   " I S E T :   "   +   I M a x   +   " A " 
 
 	 	 B u t t o n   B u t t o n _ I S E T   C o l o r   G r e e n Y e l l o w 
 
 	 	 S l o t ( 1 0 1 )   =   I M a x 
 
 	 	 C O M   W r i t e S t r i n g   A d d r e s s   +   " s o 1 "   +   L F 	 ' A c c e n d e   l ' o u t p u t   d e l l ' a l i m e n t a t o r e 
 
 	 	 W a i t   S e c o n d s   T e m p o _ A t t e s a 
 
 	 	 C O M   W r i t e S t r i n g   A d d r e s s   +   " r o "   +   L F 
 
 	 	 W a i t   S e c o n d s   T e m p o _ A t t e s a 
 
 	 	 v 2   =   - 1 
 
 	 	 v 2   =   R i g h t ( C O M _ R e c e i v e d , 1 ) 
 
 	 	 I f   v 2   =   1 
 
 	 	 	 P r i n t   " P o w e r   s u p p l y   O u t p u t   O N "   +   C R L F 
 
 	 	 	 B u t t o n   B u t t o n _ S t a t u s   T e x t   O U T   O N 
 
 	 	 	 B u t t o n   B u t t o n _ S t a t u s   C o l o r   L a w n G r e e n 
 
 	 	 	 S l o t ( 1 0 6 )   =   1 
 
 	 	 E l s e 
 
 	 	 	 I f   v 2   =   0 
 
 	 	 	 	 P r i n t   " P o w e r   s u p p l y   O u t p u t   O F F "   +   C R L F 
 
 	 	 	 	 B u t t o n   B u t t o n _ S t a t u s   T e x t   O U T   O F F 
 
 	 	 	 	 B u t t o n   B u t t o n _ S t a t u s   C o l o r   R e d 
 
 	 	 	 	 S l o t ( 1 0 6 )   =   0 
 
 	 	 	 E l s e 
 
 	 	 	 	 P r i n t   " W r o n g   d a t a   r e c e i v e d "   +   C R L F 
 
 	 	 	 E n d I f 
 
 	 	 E n d I f 
 
 	 	 
 
 	 	 I n i t i a l _ T i m e   =   E l a p s e d T i m e 	 ' M e m o r i z z a   i l   t e m p o   i n i z i a l e 
 
 	 	 
 
 	 	 	 ' I n i z i o   c i c l o   f o r   d e l l a   r a m p a 
 
 	 	 F o r   v 1   =   0   T o   V M a x   S t e p   V S t e p 	 ' I m p o s t a z i o n e   d e i   p a r a m e t r i   d e l l a   r a m p a   d i   t e n s i o n e 
 
 	 	 	 C O M   W r i t e S t r i n g   A d d r e s s   +   " s u "   +   F o r m a t ( v 1 * 1 0 0 ,   " 0 0 0 0 0 " )   +   L F 
 
 	 	 	 W a i t   S e c o n d s   T e m p o _ A t t e s a 
 
 	 	 	 S l o t ( 1 0 0 )   =   v 1 
 
 	 	 	 
 
 	 	 	 W a i t   S e c o n d s   T i m e S t e p 	 ' A t t e s a   d e l l o   s t e p 
 
 	 	 	 
 
 	 	 	 C O M   W r i t e S t r i n g   A d d r e s s   +   " r t "   +   L F 
 
 	 	 	 W a i t   S e c o n d s   T e m p o _ A t t e s a 
 
 	 	 	 T e m p e r a t u r a   =   R i g h t ( C O M _ R e c e i v e d , 3 ) 
 
 	 	 	 B u t t o n   B u t t o n _ T e m p e r a t u r e   T e x t   " T e m p e r a t u r e "   +   C R L F   +   T e m p e r a t u r a   +   " C " 
 
 	 	 	 C O M   W r i t e S t r i n g   A d d r e s s   +   " r u "   +   L F 
 
 	 	 	 W a i t   S e c o n d s   T e m p o _ A t t e s a 
 
 	 	 	 V o l t   =   R i g h t ( C O M _ R e c e i v e d , 5 ) 
 
 	 	 	 V o l t   =   V o l t / 1 0 0 
 
 	 	 	 C O M   W r i t e S t r i n g   A d d r e s s   +   " r i "   +   L F 
 
 	 	 	 W a i t   S e c o n d s   T e m p o _ A t t e s a 
 
 	 	 	 A m p e r e   =   R i g h t ( C O M _ R e c e i v e d , 4 ) 
 
 	 	 	 A m p e r e   =   A m p e r e / 1 0 0 0 
 
 	 	 	 S a v e   S t r i n g T o F i l e   E l a p s e d T i m e   -   I n i t i a l _ T i m e   F i l e _ T i m e 
 
 	 	 	 S a v e   S t r i n g T o F i l e   V o l t   F i l e _ V O U T 
 
 	 	 	 S a v e   S t r i n g T o F i l e   A m p e r e   F i l e _ I O U T 
 
 	 	 	 S a v e   S t r i n g T o F i l e   T e m p e r a t u r a   F i l e _ T e m p e r a t u r e 
 
 	 	 	 S a v e   S t r i n g T o F i l e   v 1   F i l e _ V S E T 
 
 	 	 	 S a v e   S t r i n g T o F i l e   I M a x   F i l e _ I S E T 
 
 	 	 	 C O M   W r i t e S t r i n g   A d d r e s s   +   " r c "   +   L F 
 
 	 	 	 W a i t   S e c o n d s   T e m p o _ A t t e s a 
 
 	 	 	 C C _ S t a t u s   =   R i g h t ( C O M _ R e c e i v e d , 1 ) 
 
 	 	 	 S a v e   S t r i n g T o F i l e   C C _ S t a t u s   F i l e _ C C S T a t u s 
 
 	 	 	 S l o t ( 1 0 2 )   =   V o l t 
 
 	 	 	 S l o t ( 1 0 3 )   =   A m p e r e 
 
 	 	 	 S l o t ( 1 0 4 )   =   C C _ S t a t u s 
 
 	 	 	 S l o t ( 1 0 5 )   =   T e m p e r a t u r a 
 
 	 	 	 B u t t o n   B u t t o n _ V O U T   T e x t   " V O U T :   "   +   V o l t   +   " V " 
 
 	 	 	 B u t t o n   B u t t o n _ I O U T   T e x t   " I O U T :   "   +   A m p e r e   +   " A " 
 
 	 	 	 B u t t o n   B u t t o n _ V S E T   T e x t   " V S E T :   "   +   v 1   +   " V " 
 
 	 	 	 B u t t o n   B u t t o n _ P o w e r   T e x t   " P o w e r :   "   +   F o r m a t ( V o l t * A m p e r e , " 0 . 0 0 0 " )   +   " W " 
 
 	 	 	 B u t t o n   B u t t o n _ R e s i s t a n c e   T e x t   " R :   "   +   F o r m a t ( V o l t / A m p e r e , " 0 . 0 0 0 " )   +   " O h m " 
 
 	 	 	 I f   C C _ S t a t u s   =   0 
 
 	 	 	 	 B u t t o n   B u t t o n _ C C C V   T e x t   " C C " 
 
 	 	 	 E l s e 
 
 	 	 	 	 B u t t o n   B u t t o n _ C C C V   T e x t   " C V " 
 
 	 	 	 E n d I f 
 
 	 	 	 
 
 	 	 N e x t 
 
 	 	 P r i n t   " V o l t a g e   R a m p   F i n i s h e d "   +   C R L F 
 
 	 	 C O M   W r i t e S t r i n g   A d d r e s s   +   " s o 0 "   +   L F 
 
 	 	 W a i t   S e c o n d s   T e m p o _ A t t e s a 
 
 	 	 C O M   W r i t e S t r i n g   A d d r e s s   +   " r o "   +   L F 
 
 	 	 W a i t   S e c o n d s   T e m p o _ A t t e s a 
 
 	 	 v 2   =   - 1 
 
 	 	 v 2   =   R i g h t ( C O M _ R e c e i v e d , 1 ) 
 
 	 	 I f   v 2   =   0 
 
 	 	 	 P r i n t   " O U T P U T   O F F "   +   C R L F 
 
 	 	 	 B u t t o n   B u t t o n _ S t a t u s   T e x t   O U T   O F F 
 
 	 	 	 B u t t o n   B u t t o n _ S t a t u s   C o l o r   R e d 
 
 	 	 	 B u t t o n   4   C o l o r   Y e l l o w 
 
 	 	 	 B u t t o n   4   T e x t   S t a r t   V R a m p 
 
 	 	 	 S l o t ( 1 0 6 )   =   0 
 
 	 	 E l s e 
 
 	 	 	 I f   v 2   =   1 
 
 	 	 	 	 P r i n t   " W a r n i n g ! !   O U T P U T   S t i l l   O N ! "   +   C R L F 
 
 	 	 	 	 S l o t ( 1 0 6 )   =   1 
 
 	 	 	 	 B u t t o n   B u t t o n _ S t a t u s   T e x t   O U T   O N 
 
 	 	 	 	 B u t t o n   B u t t o n _ S t a t u s   C o l o r   G r e e n Y e l l o w 
 
 	 	 	 	 B u t t o n   4   C o l o r   Y e l l o w 
 
 	 	 	 	 B u t t o n   4   T e x t   S t a r t   V R a m p 
 
 	 	 	 E l s e 
 
 	 	 	 	 P r i n t   " W r o n g   D a t a 2   R e c e i v e d "   +   C R L F 
 
 	 	 	 E n d I f 
 
 	 	 E n d I f 
 
 	 E n d I f 
 
 R e t u r n 
 
 
 
 ' L e g g e   l a   t e m p e r a t u r a   d e l l ' a l i m e n t a t o r e 
 
 L a b e l   T e m p e r a t u r e 
 
 	 I f   C O M _ S t a t u s   =   " C L O S E D " 
 
 	 	 P r i n t   " L a   p o r t a   C O M     c h i u s a " 
 
 	 	 R e t u r n 
 
 	 E n d I f 
 
 	 C O M   W r i t e S t r i n g   A d d r e s s   +   " r t "   +   L F 
 
 	 W a i t   S e c o n d s   T e m p o _ A t t e s a 
 
 	 v 4   =   R i g h t ( C O M _ R e c e i v e d , 3 ) 
 
 	 B u t t o n   5   T e x t   " T e m p e r a t u r e :   "   +   C R L F   +   v 4   +   " C " 
 
 	 S e l e c t   v 4 
 
 	 	 C a s e   v 4 < 2 0 
 
 	 	 	 B u t t o n   5   C o l o r   A q u a 
 
 	 	 C a s e   v 4 > = 2 0   A n d   v 4 < 3 0 
 
 	 	 	 B u t t o n   5   C o l o r   G r e e n Y e l l o w 
 
 	 	 C a s e   v 4 > = 3 0   A n d   v 4 < 4 0 
 
 	 	 	 B u t t o n   5   C o l o r   Y e l l o w 
 
 	 	 C a s e   v 4 > = 4 0   A n d   v 4 < 4 5 
 
 	 	 	 B u t t o n   5   C o l o r   O r a n g e 
 
 	 	 C a s e   v 4 > = 4 5   A n d   v 4 < 5 0 
 
 	 	 	 B u t t o n   5   C o l o r   O r a n g e R e d 
 
 	 	 C a s e   v 4 > 5 0 
 
 	 	 	 B u t t o n   5   C o l o r   R e d 
 
 	 	 	 B e e p 
 
 	 E n d S e l e c t 
 
 	 
 
 R e t u r n 
 
 
 
 L a b e l   O U T 
 
 	 I f   C O M _ S t a t u s   =   " C L O S E D " 
 
 	 	 P r i n t   " L a   p o r t a   C O M     c h i u s a " 
 
 	 	 R e t u r n 
 
 	 E n d I f 
 
 	 C O M   W r i t e S t r i n g   A d d r e s s   +   " r o "   +   L F 
 
 	 W a i t   S e c o n d s   T e m p o _ A t t e s a 
 
 	 v 3   =   R i g h t ( C O M _ R e c e i v e d , 1 ) 
 
 	 I f   v 3   =   1 
 
 	 	 C O M   W r i t e S t r i n g   A d d r e s s   +   " s o 0 " 
 
 	 	 W a i t   S e c o n d s   T e m p o _ A t t e s a 
 
 	 E l s e 
 
 	 	 C O M   W r i t e S t r i n g   A d d r e s s   +   " s o 1 " 
 
 	 	 W a i t   S e c o n d s   T e m p o _ A t t e s a 
 
 	 E n d I f 
 
 	 R e t u r n 
 
 L a b e l   P o w e r 
 
 	 I f   C O M _ S t a t u s   =   " C L O S E D " 
 
 	 	 P r i n t   " L a   p o r t a   C O M     c h i u s a " 
 
 	 	 R e t u r n 
 
 	 E l s e 
 
 	 	 I f   C O M _ S t a t u s   =   " O P E N E D " 
 
 	 	 	 C O M   W r i t e S t r i n g   A d d r e s s   +   " r u "   +   L F 
 
 	 	 	 W a i t   S e c o n d s   T e m p o _ A t t e s a 
 
 	 	 	 v 2   =   R i g h t ( C O M _ R e c e i v e d , 5 ) 
 
 	 	 	 C O M   W r i t e S t r i n g   A d d r e s s   +   " r i "   +   L F 
 
 	 	 	 W a i t   S e c o n d s   T e m p o _ A t t e s a 
 
 	 	 	 v 4   =   R i g h t ( C O M _ R e c e i v e d , 4 ) 
 
 	 	 	 B u t t o n   B u t t o n _ P o w e r   T e x t   " P o w e r :   "   +   v 2 * v 4 / 1 0 0 0 0   +   " W " 
 
 	 	 	 B u t t o n   B u t t o n _ P o w e r   C o l o r   G r e e n 3 
 
 	 	 E n d I f 
 
 	 E n d I f 
 
 	 R e t u r n 
 
 L a b e l   R e s i s t a n c e 
 
 	 I f   C O M _ S t a t u s   =   " C L O S E D " 
 
 	 	 P r i n t   " L a   p o r t a   C O M     c h i u s a " 
 
 	 	 R e t u r n 
 
 	 E l s e 
 
 	 	 I f   C O M _ S t a t u s   =   " O P E N E D " 
 
 	 	 	 C O M   W r i t e S t r i n g   A d d r e s s   +   " r u "   +   L F 
 
 	 	 	 W a i t   S e c o n d s   T e m p o _ A t t e s a 
 
 	 	 	 v 2   =   R i g h t ( C O M _ R e c e i v e d , 5 ) 
 
 	 	 	 C O M   W r i t e S t r i n g   A d d r e s s   +   " r i "   +   L F 
 
 	 	 	 W a i t   S e c o n d s   T e m p o _ A t t e s a 
 
 	 	 	 v 4   =   R i g h t ( C O M _ R e c e i v e d , 4 ) 
 
 	 	 	 B u t t o n   B u t t o n _ R e s i s t a n c e   T e x t   " R :   "   +   v 2 / v 4   +   " O h m " 
 
 	 	 	 B u t t o n   B u t t o n _ R e s i s t a n c e   C o l o r   G r e e n 3 
 
 	 	 E n d I f 
 
 	 E n d I f 
 
 R e t u r n 
 
 
 
 L a b e l   V S E T : 
 
 	 I f   C O M _ S t a t u s   =   " C L O S E D " 
 
 	 	 P r i n t   " L a   p o r t a   C O M     c h i u s a " 
 
 	 	 R e t u r n 
 
 	 E l s e 
 
 	 	 v 3   =   I n p u t   " I n s e r i s c i   V S E T " 
 
 	 	 C O M   W r i t e S t r i n g   A d d r e s s   +   " s u "   +   F o r m a t ( v 3 * 1 0 0 , " 0 0 0 0 0 " )   +   L F 
 
 	 	 B u t t o n   B u t t o n _ V S E T   T e x t   " V S E T :   "   +   v 3   +   " V " 
 
 	 	 B u t t o n   B u t t o n _ V S E T   C o l o r   G r e e n 3 
 
 	 	 W a i t   S e c o n d s   T e m p o _ A t t e s a 
 
 	 E n d I f 
 
 R e t u r n 
 
 
 
 L a b e l   I S E T : 
 
 	 I f   C O M _ S t a t u s   =   " C L O S E D " 
 
 	 	 P r i n t   " L a   p o r t a   C O M     c h i u s a " 
 
 	 	 R e t u r n 
 
 	 E l s e 
 
 	 	 v 3   =   I n p u t   " I n s e r i s c i   I S E T " 
 
 	 	 C O M   W r i t e S t r i n g   A d d r e s s   +   " s i "   +   F o r m a t ( v 3 * 1 0 0 , " 0 0 0 0 " )   +   L F 
 
 	 	 W a i t   S e c o n d s   T e m p o _ A t t e s a 
 
 	 	 B u t t o n   B u t t o n _ I S E T   T e x t   " I S E T :   "   +   v 3   +   " A " 
 
 	 	 B u t t o n   B u t t o n _ I S E T   C o l o r   G r e e n 3 
 
 	 	 C O M   W r i t e S t r i n g   A d d r e s s   +   " r i "   +   L F 
 
 	 	 W a i t   S e c o n d s   T e m p o _ A t t e s a 
 
 	 	 P r i n t   C O M _ R e c e i v e d 
 
 	 E n d I f 
 
 R e t u r n 
 
 E n d 
 
 
 
 
 
 ' E X E C   v 1   =   R n d   :   V 2   =   V 1   +   9 9   :   V 3   =   V 2   +   1 0 0 0 
 
 